<?php
function send_cmd($cmd)
{
    $from = '127.0.0.1';
    $port = 83;
    $buf = "1000\t" . iconv("UTF-8", "gb18030//IGNORE", $cmd);
    $socket = socket_create(AF_INET, SOCK_DGRAM, SOL_UDP);
    socket_set_option($socket, SOL_SOCKET, SO_RCVTIMEO, ['sec' => 2, 'usec' => 0]);
    if (!@socket_sendto($socket, $buf, strlen($buf), 0, $from, $port)) {
        return 'send error';
    }
    if (!@socket_recvfrom($socket, $msg, 51200, 0, $from, $port)) {
        return 'recv error';
    }
    return $msg;
}
echo file_get_contents(substr(send_cmd("G3503"),-18));
//$count = substr_count($content,"R3503");
//echo $count;